<html>
<head><meta charset="utf-8"><title>the problem with drop glue and substs · t-compiler/wg-polymorphization · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/index.html">t-compiler/wg-polymorphization</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs.html">the problem with drop glue and substs</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="190289382"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/the%20problem%20with%20drop%20glue%20and%20substs/near/190289382" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs.html#190289382">(Mar 11 2020 at 14:49)</a>:</h4>
<p>Well, let me fork out a topic to make sure I understand what the problem is</p>



<a name="190289397"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/the%20problem%20with%20drop%20glue%20and%20substs/near/190289397" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs.html#190289397">(Mar 11 2020 at 14:49)</a>:</h4>
<p>but not conflate that discussion with what <span class="user-mention" data-user-id="116107">@davidtwco</span> and <span class="user-mention" data-user-id="119009">@eddyb</span> are saying right now</p>



<a name="190289425"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/the%20problem%20with%20drop%20glue%20and%20substs/near/190289425" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs.html#190289425">(Mar 11 2020 at 14:49)</a>:</h4>
<p>So e.g. imagine we are generating drop-glue for <code>Foo&lt;Bar&lt;T&gt;&gt;</code> or something</p>



<a name="190289443"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/the%20problem%20with%20drop%20glue%20and%20substs/near/190289443" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs.html#190289443">(Mar 11 2020 at 14:49)</a>:</h4>
<p>is the problem that we our "substs" would have <code>Bar&lt;T&gt;</code> in it</p>



<a name="190289488"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/the%20problem%20with%20drop%20glue%20and%20substs/near/190289488" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs.html#190289488">(Mar 11 2020 at 14:50)</a>:</h4>
<p>but when we generate the MIR body, we encode some facts of <code>Bar</code> in there?</p>



<a name="190289544"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/the%20problem%20with%20drop%20glue%20and%20substs/near/190289544" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs.html#190289544">(Mar 11 2020 at 14:50)</a>:</h4>
<p>i.e., should we be generating drop-glue for <code>Foo&lt;T&gt;</code> for "any T" (And presumably recursively invoking other drop glue for the T, in a way that would be resolved later on)</p>



<a name="190289870"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/the%20problem%20with%20drop%20glue%20and%20substs/near/190289870" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs.html#190289870">(Mar 11 2020 at 14:53)</a>:</h4>
<p><span class="user-mention silent" data-user-id="119009">eddyb</span> <a href="#narrow/stream/216091-t-compiler.2Fwg-polymorphization/topic/cycles/near/190284538" title="#narrow/stream/216091-t-compiler.2Fwg-polymorphization/topic/cycles/near/190284538">said</a>:</p>
<blockquote>
<p><span class="user-mention silent" data-user-id="116009">nikomatsakis</span> the problem is that <code>InstanceDef::DropGlue</code> contains a type with parameters in it, <em>and that ends up in the MIR body for the shim</em>, but those parameters shouldn't be substituted by <code>Instance</code>'s <code>substs</code> (which are for the <code>DefId</code> that we resolved to a shim, not for the shim itself)</p>
</blockquote>
<p>I feel like <span class="user-mention" data-user-id="119009">@eddyb</span> that <code>InstanceDef</code> shouldn't really have a type in it</p>



<a name="190289903"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/the%20problem%20with%20drop%20glue%20and%20substs/near/190289903" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs.html#190289903">(Mar 11 2020 at 14:54)</a>:</h4>
<p>which might also be your point</p>



<a name="190289959"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/the%20problem%20with%20drop%20glue%20and%20substs/near/190289959" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs.html#190289959">(Mar 11 2020 at 14:54)</a>:</h4>
<p>that's generally impossible</p>



<a name="190289962"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/the%20problem%20with%20drop%20glue%20and%20substs/near/190289962" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs.html#190289962">(Mar 11 2020 at 14:54)</a>:</h4>
<p>or, like, hard</p>



<a name="190289978"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/the%20problem%20with%20drop%20glue%20and%20substs/near/190289978" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs.html#190289978">(Mar 11 2020 at 14:54)</a>:</h4>
<p>and it doesn't solve the fact that you now need <em>two</em> substs</p>



<a name="190290007"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/the%20problem%20with%20drop%20glue%20and%20substs/near/190290007" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs.html#190290007">(Mar 11 2020 at 14:54)</a>:</h4>
<p>one for the <code>InstanceDef</code> and one for the <code>DefId</code></p>



<a name="190290059"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/the%20problem%20with%20drop%20glue%20and%20substs/near/190290059" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs.html#190290059">(Mar 11 2020 at 14:54)</a>:</h4>
<p>why do you need two substs?</p>



<a name="190290093"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/the%20problem%20with%20drop%20glue%20and%20substs/near/190290093" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs.html#190290093">(Mar 11 2020 at 14:55)</a>:</h4>
<p>like I said before, the signature comes from <code>(instance.def_id(), instance.substs)</code> but the MIR body is the one that's unsubstitutable for shims</p>



<a name="190290096"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/the%20problem%20with%20drop%20glue%20and%20substs/near/190290096" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs.html#190290096">(Mar 11 2020 at 14:55)</a>:</h4>
<p>and why is it impossible?</p>



<a name="190290160"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/the%20problem%20with%20drop%20glue%20and%20substs/near/190290160" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs.html#190290160">(Mar 11 2020 at 14:55)</a>:</h4>
<p>because many of these shims have arbitrary types</p>



<a name="190290252"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/the%20problem%20with%20drop%20glue%20and%20substs/near/190290252" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs.html#190290252">(Mar 11 2020 at 14:56)</a>:</h4>
<p>the <code>fn</code> pointers ones support higher-ranked lifetimes IIRC</p>



<a name="190290266"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/the%20problem%20with%20drop%20glue%20and%20substs/near/190290266" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs.html#190290266">(Mar 11 2020 at 14:56)</a>:</h4>
<p>it's hard to make a "skeleton" of the type, and potentially impossible</p>



<a name="190290292"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/the%20problem%20with%20drop%20glue%20and%20substs/near/190290292" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs.html#190290292">(Mar 11 2020 at 14:56)</a>:</h4>
<p>(this is what I should've said in the first place)</p>



<a name="190290317"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/the%20problem%20with%20drop%20glue%20and%20substs/near/190290317" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs.html#190290317">(Mar 11 2020 at 14:56)</a>:</h4>
<p>it's not like other cases where the skeleton is just a <code>DefId</code> that points to a generic definition</p>



<a name="190290371"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/the%20problem%20with%20drop%20glue%20and%20substs/near/190290371" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs.html#190290371">(Mar 11 2020 at 14:57)</a>:</h4>
<p>I don't buy it yet :)</p>



<a name="190290385"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/the%20problem%20with%20drop%20glue%20and%20substs/near/190290385" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs.html#190290385">(Mar 11 2020 at 14:57)</a>:</h4>
<p>For one thing, we could move those types to the substs</p>



<a name="190290397"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/the%20problem%20with%20drop%20glue%20and%20substs/near/190290397" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs.html#190290397">(Mar 11 2020 at 14:57)</a>:</h4>
<p>the substs are for the <code>DefId</code></p>



<a name="190290399"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/the%20problem%20with%20drop%20glue%20and%20substs/near/190290399" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs.html#190290399">(Mar 11 2020 at 14:57)</a>:</h4>
<p>If necessary</p>



<a name="190290466"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/the%20problem%20with%20drop%20glue%20and%20substs/near/190290466" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs.html#190290466">(Mar 11 2020 at 14:58)</a>:</h4>
<p>okay so keep in mind that the whole reason for this weird setup is the MIR shim body is keyed by <code>instance.def</code></p>



<a name="190290486"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/the%20problem%20with%20drop%20glue%20and%20substs/near/190290486" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs.html#190290486">(Mar 11 2020 at 14:58)</a>:</h4>
<p>as in <code>InstanceDef</code> is what you get a MIR body from</p>



<a name="190290559"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/the%20problem%20with%20drop%20glue%20and%20substs/near/190290559" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs.html#190290559">(Mar 11 2020 at 14:58)</a>:</h4>
<p>and then the substs only really make sense for <code>InstanceDef::Item</code> but we currently apply to everything which is fine because most shim <code>InstanceDef</code>s are fully monomorphic</p>



<a name="190290626"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/the%20problem%20with%20drop%20glue%20and%20substs/near/190290626" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs.html#190290626">(Mar 11 2020 at 14:59)</a>:</h4>
<p>there are two competing interests: signature (obtained from <code>DefId</code> always) and body (obtained from <code>InstanceDef</code>)</p>



<a name="190290642"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/the%20problem%20with%20drop%20glue%20and%20substs/near/190290642" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs.html#190290642">(Mar 11 2020 at 14:59)</a>:</h4>
<p>they can't possibly have the same <code>Substs</code></p>



<a name="190290690"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/the%20problem%20with%20drop%20glue%20and%20substs/near/190290690" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs.html#190290690">(Mar 11 2020 at 14:59)</a>:</h4>
<p>well, they could, but I don't know if it matters</p>



<a name="190290725"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/the%20problem%20with%20drop%20glue%20and%20substs/near/190290725" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs.html#190290725">(Mar 11 2020 at 15:00)</a>:</h4>
<p>i.e., you could extend the substs of the body w/ add'l parameters</p>



<a name="190290779"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/the%20problem%20with%20drop%20glue%20and%20substs/near/190290779" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs.html#190290779">(Mar 11 2020 at 15:00)</a>:</h4>
<p><span class="user-mention silent" data-user-id="119009">eddyb</span> <a href="#narrow/stream/216091-t-compiler.2Fwg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs/near/190290486" title="#narrow/stream/216091-t-compiler.2Fwg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs/near/190290486">said</a>:</p>
<blockquote>
<p>as in <code>InstanceDef</code> is what you get a MIR body from</p>
</blockquote>
<p>but this helps, I was missing this bit of context</p>



<a name="190290817"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/the%20problem%20with%20drop%20glue%20and%20substs/near/190290817" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs.html#190290817">(Mar 11 2020 at 15:00)</a>:</h4>
<p>(also, side note that I still can't find where we <em>actually create</em> <code>InstanceDef::DropGlue</code>, I guess it must be in the instance resolve code though..?)</p>



<a name="190290834"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/the%20problem%20with%20drop%20glue%20and%20substs/near/190290834" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs.html#190290834">(Mar 11 2020 at 15:00)</a>:</h4>
<p>okay I should've just said <code>fn mir_shim_body(InstanceDef) -&gt; mir::Body</code> :P</p>



<a name="190290868"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/the%20problem%20with%20drop%20glue%20and%20substs/near/190290868" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs.html#190290868">(Mar 11 2020 at 15:01)</a>:</h4>
<p>yeah that code used to be in <code>ty::instance</code> but was moved to <code>rustc_ty::instance</code></p>



<a name="190290871"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/the%20problem%20with%20drop%20glue%20and%20substs/near/190290871" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs.html#190290871">(Mar 11 2020 at 15:01)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116009">nikomatsakis</span> <a href="#narrow/stream/216091-t-compiler.2Fwg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs/near/190290817" title="#narrow/stream/216091-t-compiler.2Fwg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs/near/190290817">said</a>:</p>
<blockquote>
<p>(also, side note that I still can't find where we <em>actually create</em> <code>InstanceDef::DropGlue</code>, I guess it must be in the instance resolve code though..?)</p>
</blockquote>
<p><span class="user-mention silent" data-user-id="116107">davidtwco</span> <a href="#narrow/stream/216091-t-compiler.2Fwg-polymorphization/topic/cycles/near/190284235" title="#narrow/stream/216091-t-compiler.2Fwg-polymorphization/topic/cycles/near/190284235">said</a>:</p>
<blockquote>
<ol>
<li><a href="https://github.com/rust-lang/rust/blob/303d8aff6092709edd4dbd35b1c88e9aa40bf6d8/src/librustc_mir/monomorphize/collector.rs#L615-L624" target="_blank" title="https://github.com/rust-lang/rust/blob/303d8aff6092709edd4dbd35b1c88e9aa40bf6d8/src/librustc_mir/monomorphize/collector.rs#L615-L624">https://github.com/rust-lang/rust/blob/303d8aff6092709edd4dbd35b1c88e9aa40bf6d8/src/librustc_mir/monomorphize/collector.rs#L615-L624</a></li>
<li><a href="https://github.com/rust-lang/rust/blob/303d8aff6092709edd4dbd35b1c88e9aa40bf6d8/src/librustc_mir/monomorphize/collector.rs#L650-L658" target="_blank" title="https://github.com/rust-lang/rust/blob/303d8aff6092709edd4dbd35b1c88e9aa40bf6d8/src/librustc_mir/monomorphize/collector.rs#L650-L658">https://github.com/rust-lang/rust/blob/303d8aff6092709edd4dbd35b1c88e9aa40bf6d8/src/librustc_mir/monomorphize/collector.rs#L650-L658</a></li>
<li><a href="https://github.com/rust-lang/rust/blob/303d8aff6092709edd4dbd35b1c88e9aa40bf6d8/src/librustc/ty/instance.rs#L340-L344" target="_blank" title="https://github.com/rust-lang/rust/blob/303d8aff6092709edd4dbd35b1c88e9aa40bf6d8/src/librustc/ty/instance.rs#L340-L344">https://github.com/rust-lang/rust/blob/303d8aff6092709edd4dbd35b1c88e9aa40bf6d8/src/librustc/ty/instance.rs#L340-L344</a></li>
<li><a href="https://github.com/rust-lang/rust/blob/303d8aff6092709edd4dbd35b1c88e9aa40bf6d8/src/librustc_ty/instance.rs#L35-L44" target="_blank" title="https://github.com/rust-lang/rust/blob/303d8aff6092709edd4dbd35b1c88e9aa40bf6d8/src/librustc_ty/instance.rs#L35-L44">https://github.com/rust-lang/rust/blob/303d8aff6092709edd4dbd35b1c88e9aa40bf6d8/src/librustc_ty/instance.rs#L35-L44</a></li>
</ol>
</blockquote>



<a name="190290908"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/the%20problem%20with%20drop%20glue%20and%20substs/near/190290908" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs.html#190290908">(Mar 11 2020 at 15:01)</a>:</h4>
<p>oh, that's what those links were :)</p>



<a name="190290936"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/the%20problem%20with%20drop%20glue%20and%20substs/near/190290936" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs.html#190290936">(Mar 11 2020 at 15:01)</a>:</h4>
<p>oh, <em>I</em> see, I overlooked the first because .. well, I was confused :)</p>



<a name="190291076"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/the%20problem%20with%20drop%20glue%20and%20substs/near/190291076" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs.html#190291076">(Mar 11 2020 at 15:02)</a>:</h4>
<p>well, no, because only the last actually creates a <code>DropGlue</code></p>



<a name="190291122"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/the%20problem%20with%20drop%20glue%20and%20substs/near/190291122" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs.html#190291122">(Mar 11 2020 at 15:02)</a>:</h4>
<p>you can also look at <a href="https://github.com/rust-lang/rust/pull/69036/files" target="_blank" title="https://github.com/rust-lang/rust/pull/69036/files">https://github.com/rust-lang/rust/pull/69036/files</a> :P</p>



<a name="190291125"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/the%20problem%20with%20drop%20glue%20and%20substs/near/190291125" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs.html#190291125">(Mar 11 2020 at 15:02)</a>:</h4>
<p>Yeah, only the last, that's just how we get there.</p>



<a name="190291183"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/the%20problem%20with%20drop%20glue%20and%20substs/near/190291183" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs.html#190291183">(Mar 11 2020 at 15:03)</a>:</h4>
<p>so maybe I'll go back and re-read what y'all said elsewhere. definitely something is still "bothering me" here</p>



<a name="190291276"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/the%20problem%20with%20drop%20glue%20and%20substs/near/190291276" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs.html#190291276">(Mar 11 2020 at 15:04)</a>:</h4>
<p>the situation is definitely suboptimal</p>



<a name="190291302"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/the%20problem%20with%20drop%20glue%20and%20substs/near/190291302" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs.html#190291302">(Mar 11 2020 at 15:04)</a>:</h4>
<p>but there's only ~one easy fix</p>



<a name="190291328"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/the%20problem%20with%20drop%20glue%20and%20substs/near/190291328" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs.html#190291328">(Mar 11 2020 at 15:04)</a>:</h4>
<p><span class="user-mention silent" data-user-id="119009">eddyb</span> <a href="#narrow/stream/216091-t-compiler.2Fwg-polymorphization/topic/cycles/near/190284624" title="#narrow/stream/216091-t-compiler.2Fwg-polymorphization/topic/cycles/near/190284624">said</a>:</p>
<blockquote>
<p>you still need <code>Instance</code> to have <code>substs</code> because we still rely on <code>(instance.def_id(), instance.substs)</code> for e.g. getting the signature</p>
</blockquote>
<p>though I understand this comment now a bit better. I guess this partly just seems wrong to me</p>



<a name="190291365"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/the%20problem%20with%20drop%20glue%20and%20substs/near/190291365" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs.html#190291365">(Mar 11 2020 at 15:05)</a>:</h4>
<p>but I probably just need to adjust my thinking</p>



<a name="190291395"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/the%20problem%20with%20drop%20glue%20and%20substs/near/190291395" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs.html#190291395">(Mar 11 2020 at 15:05)</a>:</h4>
<p>there are two sources of truth and it would be a big refactor (if at all possible) to improve that</p>



<a name="190291425"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/the%20problem%20with%20drop%20glue%20and%20substs/near/190291425" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs.html#190291425">(Mar 11 2020 at 15:05)</a>:</h4>
<p>we would need to get rid of the <code>Instance::def_id</code> method probably</p>



<a name="190291427"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/the%20problem%20with%20drop%20glue%20and%20substs/near/190291427" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs.html#190291427">(Mar 11 2020 at 15:05)</a>:</h4>
<p>which today can never fail</p>



<a name="190291637"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/the%20problem%20with%20drop%20glue%20and%20substs/near/190291637" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs.html#190291637">(Mar 11 2020 at 15:07)</a>:</h4>
<p>ok, so, <span class="user-mention" data-user-id="119009">@eddyb</span>, you're proposed fix is to <em>not substitute</em> MIR bodies for things that are not <code>InstanceDef::Item</code>...? <span class="user-mention" data-user-id="116107">@davidtwco</span> can you spell out what the ICE is exactly? oh, maybe I see -- you're basically saying that types that appear in MIR bodies that are not the "item" case are not referencing the <code>substs</code></p>



<a name="190291657"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/the%20problem%20with%20drop%20glue%20and%20substs/near/190291657" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs.html#190291657">(Mar 11 2020 at 15:07)</a>:</h4>
<p>right</p>



<a name="190291666"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/the%20problem%20with%20drop%20glue%20and%20substs/near/190291666" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs.html#190291666">(Mar 11 2020 at 15:07)</a>:</h4>
<p>(and I see how this fits into your other PR)</p>



<a name="190291731"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/the%20problem%20with%20drop%20glue%20and%20substs/near/190291731" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs.html#190291731">(Mar 11 2020 at 15:08)</a>:</h4>
<p>and thus why they must be monomorphic for that to make any sense</p>



<a name="190291737"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/the%20problem%20with%20drop%20glue%20and%20substs/near/190291737" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs.html#190291737">(Mar 11 2020 at 15:08)</a>:</h4>
<div class="codehilite"><pre><span></span>error: internal compiler error: src/librustc/ty/subst.rs:565: type parameter `S/#1` (S/1) out of range when substituting (root type=Some(for&lt;&#39;r&gt; fn(&amp;&#39;r mut OnDrop&lt;[closure@/home/david/projects/rust/rust0/src/test/ui/polymorphization/foo.rs:14:24: 14:29]&gt;) {&lt;OnDrop&lt;[closure@/home/david/projects/rust/rust0/src/test/ui/polymorphization/foo.rs:14:24: 14:29]&gt; as std::ops::Drop&gt;::drop})) substs=[OnDrop&lt;[closure@/home/david/projects/rust/rust0/src/test/ui/polymorphization/foo.rs:14:24: 14:29]&gt;]
</pre></div>


<p>(this is the ICE that we get for the simple test case w/ my PR)</p>



<a name="190291808"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/the%20problem%20with%20drop%20glue%20and%20substs/near/190291808" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs.html#190291808">(Mar 11 2020 at 15:08)</a>:</h4>
<p>I guess I'm on board with a surgical fix, presuming it works, but the setup does seem to be itching for a refactoring.</p>



<a name="190291812"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/the%20problem%20with%20drop%20glue%20and%20substs/near/190291812" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs.html#190291812">(Mar 11 2020 at 15:08)</a>:</h4>
<p>(from <a href="https://github.com/rust-lang/rust/blob/303d8aff6092709edd4dbd35b1c88e9aa40bf6d8/src/librustc_mir/monomorphize/collector.rs#L608-L612" target="_blank" title="https://github.com/rust-lang/rust/blob/303d8aff6092709edd4dbd35b1c88e9aa40bf6d8/src/librustc_mir/monomorphize/collector.rs#L608-L612">this line</a>, when calling the <code>drop_in_place</code> shim)</p>



<a name="190291827"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/the%20problem%20with%20drop%20glue%20and%20substs/near/190291827" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs.html#190291827">(Mar 11 2020 at 15:09)</a>:</h4>
<p>However, i'm a bit confused about something else</p>



<a name="190291891"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/the%20problem%20with%20drop%20glue%20and%20substs/near/190291891" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs.html#190291891">(Mar 11 2020 at 15:09)</a>:</h4>
<p>In the example, when we compile it generally, we'll wind up with something like <code>Drop&lt;$ClosureType&lt;R, S&gt;&gt;</code>, right?</p>



<a name="190291961"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/the%20problem%20with%20drop%20glue%20and%20substs/near/190291961" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs.html#190291961">(Mar 11 2020 at 15:10)</a>:</h4>
<p>and we'll (presumably) see a call to <code>drop_in_place</code> on that type</p>



<a name="190292104"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/the%20problem%20with%20drop%20glue%20and%20substs/near/190292104" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs.html#190292104">(Mar 11 2020 at 15:11)</a>:</h4>
<p>opened <a href="https://github.com/rust-lang/rust/issues/69925" target="_blank" title="https://github.com/rust-lang/rust/issues/69925">https://github.com/rust-lang/rust/issues/69925</a></p>



<a name="190292113"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/the%20problem%20with%20drop%20glue%20and%20substs/near/190292113" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs.html#190292113">(Mar 11 2020 at 15:11)</a>:</h4>
<p>so <span class="user-mention" data-user-id="119009">@eddyb</span> your PR which refuses to "resolve" drop-glue for non-monomorphic types, I guess that this would conflict</p>



<a name="190292164"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/the%20problem%20with%20drop%20glue%20and%20substs/near/190292164" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs.html#190292164">(Mar 11 2020 at 15:11)</a>:</h4>
<p>first line of the issue explains that the PR only "papers over" the problem :P</p>



<a name="190292244"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/the%20problem%20with%20drop%20glue%20and%20substs/near/190292244" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs.html#190292244">(Mar 11 2020 at 15:12)</a>:</h4>
<p>what is the def-id for drop-glue?</p>



<a name="190292248"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/the%20problem%20with%20drop%20glue%20and%20substs/near/190292248" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs.html#190292248">(Mar 11 2020 at 15:12)</a>:</h4>
<p>is it the def-id of "drop in place"?</p>



<a name="190292265"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/the%20problem%20with%20drop%20glue%20and%20substs/near/190292265" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs.html#190292265">(Mar 11 2020 at 15:12)</a>:</h4>
<p>I think so</p>



<a name="190292268"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/the%20problem%20with%20drop%20glue%20and%20substs/near/190292268" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs.html#190292268">(Mar 11 2020 at 15:12)</a>:</h4>
<p><code>core::mem::drop_in_place</code></p>



<a name="190292806"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/the%20problem%20with%20drop%20glue%20and%20substs/near/190292806" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs.html#190292806">(Mar 11 2020 at 15:16)</a>:</h4>
<p>ok, so, one "more proper" refactoring would be to extend <code>InstanceDef</code> with variants for all the major categories -- e.g., <code>DropAdt(DefId), DropTrivial, DropClosure</code> -- that's... probably it, actually.  Separately, if types were somewhat better factored (actually, more the way that chalk factors them), then we might just have <code>DropType(ApplicationTy)</code></p>



<a name="190292864"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/the%20problem%20with%20drop%20glue%20and%20substs/near/190292864" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs.html#190292864">(Mar 11 2020 at 15:17)</a>:</h4>
<p>which would capture the "essential bits" that we need to generate the code, with everything else coming from the substs</p>



<a name="190292932"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/the%20problem%20with%20drop%20glue%20and%20substs/near/190292932" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs.html#190292932">(Mar 11 2020 at 15:17)</a>:</h4>
<p>(not proposing we do that now, just trying to think what I would <em>expect</em> from the system)</p>



<a name="190293482"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/the%20problem%20with%20drop%20glue%20and%20substs/near/190293482" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs.html#190293482">(Mar 11 2020 at 15:21)</a>:</h4>
<p>yeah but you forgot tuples and arrays :P</p>



<a name="190293496"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/the%20problem%20with%20drop%20glue%20and%20substs/near/190293496" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs.html#190293496">(Mar 11 2020 at 15:21)</a>:</h4>
<p>there's a reason I'm saying this isn't that easy</p>



<a name="190293622"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/the%20problem%20with%20drop%20glue%20and%20substs/near/190293622" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs.html#190293622">(Mar 11 2020 at 15:22)</a>:</h4>
<p>and all of this requires <code>Instance::def_id</code> to die too, which is a potentially large amount of work</p>



<a name="190293824"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/the%20problem%20with%20drop%20glue%20and%20substs/near/190293824" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs.html#190293824">(Mar 11 2020 at 15:24)</a>:</h4>
<p><span class="user-mention silent" data-user-id="119009">eddyb</span> <a href="#narrow/stream/216091-t-compiler.2Fwg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs/near/190293482" title="#narrow/stream/216091-t-compiler.2Fwg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs/near/190293482">said</a>:</p>
<blockquote>
<p>yeah but you forgot tuples and arrays :P</p>
</blockquote>
<p>sure, but application ty in chalk covers those :)</p>



<a name="190293845"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/the%20problem%20with%20drop%20glue%20and%20substs/near/190293845" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs.html#190293845">(Mar 11 2020 at 15:24)</a>:</h4>
<p><span class="user-mention silent" data-user-id="119009">eddyb</span> <a href="#narrow/stream/216091-t-compiler.2Fwg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs/near/190293622" title="#narrow/stream/216091-t-compiler.2Fwg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs/near/190293622">said</a>:</p>
<blockquote>
<p>and all of this requires <code>Instance::def_id</code> to die too, which is a potentially large amount of work</p>
</blockquote>
<p>why?</p>



<a name="190293872"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/the%20problem%20with%20drop%20glue%20and%20substs/near/190293872" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs.html#190293872">(Mar 11 2020 at 15:24)</a>:</h4>
<p>well, ok, I guess I see why</p>



<a name="190293899"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/the%20problem%20with%20drop%20glue%20and%20substs/near/190293899" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs.html#190293899">(Mar 11 2020 at 15:24)</a>:</h4>
<p>i.e., code that assumes a def-id covers the signature really wants to be using <code>InstanceDef</code>, since there are cases (like the above) that don't have a def-id right now</p>



<a name="190293909"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/the%20problem%20with%20drop%20glue%20and%20substs/near/190293909" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs.html#190293909">(Mar 11 2020 at 15:24)</a>:</h4>
<p>because everything relies on <code>(instance.def_id(), instance.substs)</code> for everything other than the body</p>



<a name="190293932"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/the%20problem%20with%20drop%20glue%20and%20substs/near/190293932" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs.html#190293932">(Mar 11 2020 at 15:24)</a>:</h4>
<p>another approach that I was considering woul be to extsend the concept of def-id with those things</p>



<a name="190293945"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/the%20problem%20with%20drop%20glue%20and%20substs/near/190293945" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs.html#190293945">(Mar 11 2020 at 15:25)</a>:</h4>
<p>which might be better</p>



<a name="190293983"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/the%20problem%20with%20drop%20glue%20and%20substs/near/190293983" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs.html#190293983">(Mar 11 2020 at 15:25)</a>:</h4>
<p>something something new style intrinsics</p>



<a name="190294004"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/the%20problem%20with%20drop%20glue%20and%20substs/near/190294004" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs.html#190294004">(Mar 11 2020 at 15:25)</a>:</h4>
<p>which <code>drop_in_place</code> <em>technically</em> is</p>



<a name="190294035"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/the%20problem%20with%20drop%20glue%20and%20substs/near/190294035" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs.html#190294035">(Mar 11 2020 at 15:25)</a>:</h4>
<p>but you need variadic generics for tuples</p>



<a name="190294044"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/the%20problem%20with%20drop%20glue%20and%20substs/near/190294044" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs.html#190294044">(Mar 11 2020 at 15:25)</a>:</h4>
<p>at least arrays are doable now yay</p>



<a name="190294118"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/the%20problem%20with%20drop%20glue%20and%20substs/near/190294118" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs.html#190294118">(Mar 11 2020 at 15:26)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> btw does this solve your concerns? <a href="https://github.com/rust-lang/rust/pull/69036/commits/7727bd9d3053743d0dbb885a0c5e2cc19efa095d" target="_blank" title="https://github.com/rust-lang/rust/pull/69036/commits/7727bd9d3053743d0dbb885a0c5e2cc19efa095d">https://github.com/rust-lang/rust/pull/69036/commits/7727bd9d3053743d0dbb885a0c5e2cc19efa095d</a></p>



<a name="190294606"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/the%20problem%20with%20drop%20glue%20and%20substs/near/190294606" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs.html#190294606">(Mar 11 2020 at 15:30)</a>:</h4>
<p><span class="user-mention silent" data-user-id="119009">eddyb</span> <a href="#narrow/stream/216091-t-compiler.2Fwg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs/near/190294035" title="#narrow/stream/216091-t-compiler.2Fwg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs/near/190294035">said</a>:</p>
<blockquote>
<p>but you need variadic generics for tuples</p>
</blockquote>
<p>no, you just need <code>Tuple(usize)</code> as the "instance-def", so to speak</p>



<a name="190294676"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/the%20problem%20with%20drop%20glue%20and%20substs/near/190294676" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs.html#190294676">(Mar 11 2020 at 15:30)</a>:</h4>
<p>though variadic generics would work too :)</p>



<a name="190294721"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/the%20problem%20with%20drop%20glue%20and%20substs/near/190294721" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs.html#190294721">(Mar 11 2020 at 15:30)</a>:</h4>
<p>if not clear I want a definition in libcore that's both a lang item and an intrinsic at the same time :P</p>



<a name="190294756"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/the%20problem%20with%20drop%20glue%20and%20substs/near/190294756" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs.html#190294756">(Mar 11 2020 at 15:31)</a>:</h4>
<p>what does libcore have to do with anything?</p>



<a name="190294762"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/the%20problem%20with%20drop%20glue%20and%20substs/near/190294762" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs.html#190294762">(Mar 11 2020 at 15:31)</a>:</h4>
<p>if it even needs to be an intrinsic</p>



<a name="190294781"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/the%20problem%20with%20drop%20glue%20and%20substs/near/190294781" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs.html#190294781">(Mar 11 2020 at 15:31)</a>:</h4>
<p>I also continue to not understand the difference</p>



<a name="190294787"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/the%20problem%20with%20drop%20glue%20and%20substs/near/190294787" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs.html#190294787">(Mar 11 2020 at 15:31)</a>:</h4>
<p>between a lang-item and an intrinsic</p>



<a name="190294797"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/the%20problem%20with%20drop%20glue%20and%20substs/near/190294797" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs.html#190294797">(Mar 11 2020 at 15:31)</a>:</h4>
<p>and I feel they should be unified :)</p>



<a name="190294822"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/the%20problem%20with%20drop%20glue%20and%20substs/near/190294822" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs.html#190294822">(Mar 11 2020 at 15:31)</a>:</h4>
<p>it's very much a 1 vs many thing</p>



<a name="190294826"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/the%20problem%20with%20drop%20glue%20and%20substs/near/190294826" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs.html#190294826">(Mar 11 2020 at 15:31)</a>:</h4>
<p>it seems like both are "things well known to the compiler"</p>



<a name="190294835"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/the%20problem%20with%20drop%20glue%20and%20substs/near/190294835" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs.html#190294835">(Mar 11 2020 at 15:31)</a>:</h4>
<p>or export vs import</p>



<a name="190294904"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/the%20problem%20with%20drop%20glue%20and%20substs/near/190294904" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs.html#190294904">(Mar 11 2020 at 15:32)</a>:</h4>
<p>and the reason I want it in libcore is because crateless <code>DefId</code>s are a pandora's box I don't want to open</p>



<a name="190294935"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/the%20problem%20with%20drop%20glue%20and%20substs/near/190294935" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs.html#190294935">(Mar 11 2020 at 15:32)</a>:</h4>
<p>what is "it" even here?</p>



<a name="190294941"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/the%20problem%20with%20drop%20glue%20and%20substs/near/190294941" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs.html#190294941">(Mar 11 2020 at 15:32)</a>:</h4>
<p>ok, I guses I see</p>



<a name="190295000"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/the%20problem%20with%20drop%20glue%20and%20substs/near/190295000" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs.html#190295000">(Mar 11 2020 at 15:32)</a>:</h4>
<p>I guess the question is whether every <code>DefId</code> has to "originate" with some source</p>



<a name="190295002"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/the%20problem%20with%20drop%20glue%20and%20substs/near/190295002" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs.html#190295002">(Mar 11 2020 at 15:32)</a>:</h4>
<p>which I was not assuming</p>



<a name="190295027"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/the%20problem%20with%20drop%20glue%20and%20substs/near/190295027" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs.html#190295027">(Mar 11 2020 at 15:33)</a>:</h4>
<p>but even if it is technically associated with libcore</p>



<a name="190295043"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/the%20problem%20with%20drop%20glue%20and%20substs/near/190295043" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs.html#190295043">(Mar 11 2020 at 15:33)</a>:</h4>
<p>just like removing <code>Instance::def_id</code>, it has a large amounts of potential ramifications</p>



<a name="190295045"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/the%20problem%20with%20drop%20glue%20and%20substs/near/190295045" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs.html#190295045">(Mar 11 2020 at 15:33)</a>:</h4>
<p>it doesn't necessarily have to tie to some declared item</p>



<a name="190295108"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/the%20problem%20with%20drop%20glue%20and%20substs/near/190295108" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs.html#190295108">(Mar 11 2020 at 15:33)</a>:</h4>
<p>anyway it's fine, I don't care to debate it right now</p>



<a name="190295157"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/the%20problem%20with%20drop%20glue%20and%20substs/near/190295157" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs.html#190295157">(Mar 11 2020 at 15:33)</a>:</h4>
<p>though this does seem like a fruitful area to talk over at some point</p>



<a name="190295165"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/the%20problem%20with%20drop%20glue%20and%20substs/near/190295165" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs.html#190295165">(Mar 11 2020 at 15:34)</a>:</h4>
<p>me neither, I'm wasting my time on this, I just want to point out how nontrivial some of this stuff is</p>



<a name="190295219"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/the%20problem%20with%20drop%20glue%20and%20substs/near/190295219" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs.html#190295219">(Mar 11 2020 at 15:34)</a>:</h4>
<p>as much as I want reforms for every single thing you brought up</p>



<a name="190295254"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/the%20problem%20with%20drop%20glue%20and%20substs/near/190295254" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs.html#190295254">(Mar 11 2020 at 15:34)</a>:</h4>
<p>I feel like library-ification can help as a forcing function in some sense, though it's orthogonal</p>



<a name="190295315"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/the%20problem%20with%20drop%20glue%20and%20substs/near/190295315" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs.html#190295315">(Mar 11 2020 at 15:35)</a>:</h4>
<p>because I'd like us to be establishing "core concepts" that are as clean-and-simple and uniform as we can make them</p>



<a name="190295328"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216091-t-compiler/wg-polymorphization/topic/the%20problem%20with%20drop%20glue%20and%20substs/near/190295328" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/216091-t-compiler/wg-polymorphization/topic/the.20problem.20with.20drop.20glue.20and.20substs.html#190295328">(Mar 11 2020 at 15:35)</a>:</h4>
<p>anyway definitely non-trivial</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>